import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  // state 定义公共参数
  state: {
    isCollapse: false,
    collapseClass: 'navbar',
    menuData:[]
  },
  getters: {
  },
  // mutations 定义函数 改变state中的值
  mutations: {
    changeIsCollapse(state){
      state.isCollapse = !state.isCollapse
    },
    changeCollapseClass(state){
      if(state.isCollapse){
        state.collapseClass = 'navbar navbar-collapse' // 收缩 改边NavBar宽度
      }else {
        state.collapseClass = 'navbar'
      }
    },
    changeMenuData(state,payload){
      state.menuData = payload
    }
  },
  actions: {
  },
  modules: {
  }
})
